#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<ctime>
#include"BinarySearchTree.h"
using namespace std;


int main()
	{	
		BinarySearchTree<int> b;
		vector<int> data;
		data.push_back(3);
		data.push_back(2);
		data.push_back(6);
		data.push_back(5);
		data.push_back(1);
		data.push_back(4);
		data.push_back(7);
		data.push_back(8);

		BST_sort(data, b);
		cout << "中序遍历输出data :" << endl;
		for (int i = 0; i < 8; i++) {
			data[i] = b.findMin();
			cout << data[i] << " ";
			b.remove(b.findMin());
		}
		cout << endl;
		cout << "将data重新打乱:" << endl;
		Randomized_BST_sort(data);
		for (unsigned int i = 0; i < data.size(); i++) {
			cout << data[i] << " ";
		}
		cout << endl;
		cout << "再次重新插入，中序遍历输出：" << endl;
		BST_sort(data, b);
		for (int i = 0; i < 8; i++) {
			data[i] = b.findMin();
			cout << data[i] << " ";
			b.remove(b.findMin());
		}

		return 0;
	}